<?php
require_once ("../../src/db/connectdatabase.php");

function insertCardDetail($id, $idbank, $bankname, $banklogo, $btranfer, $mtranfer, $rate, $annualfee, $cardid, $ctname, $ctlogo, $freeday, $paymentfee, $minpayment, $clid, $clname, $phiruttien, $areacard, $linkgosite, $hanmuc) {
	$con = new ConnectDB();
	
	$tbl = "carddetail";
	$fn = array('carddetailid' => $id, 'bankid' => $idbank, 'bankname' => $bankname, 'banklogo' => $banklogo, 'balancetransfer' => $btranfer, 'monthstransfer' => $mtranfer, 'interestrate' => $rate, 'annualfee' => $annualfee, 'cardtypeid' => $cardid, 'cardtypename' => $ctname, 'cardtypelogo' => $ctlogo, 'interestfreedays' => $freeday, 'latepaymentfee' => $paymentfee, 'minimumrepayment' => $minpayment, 'idcardlevel' => $clid, 'cardlevelname' => $clname, 'phiruttien' => $phiruttien, 'areaofcards' => $areacard, 'linkgotosite' => $linkgosite, 'datecreate' => time(), 'cardlimit' => $hanmuc);
	return $con -> insert($tbl, $fn);
}

function updateCardDetail($id, $idbank, $bankname, $banklogo, $btranfer, $mtranfer, $rate, $annualfee, $cardid, $ctname, $ctlogo, $freeday, $paymentfee, $minpayment, $clid, $clname, $phiruttien, $areacard, $linkgosite, $hanmuc) {
	$con = new ConnectDB();
	
	$tbl = "carddetail";
	$fn = array('bankid' => $idbank, 'bankname' => $bankname, 'banklogo' => $banklogo, 'balancetransfer' => $btranfer, 'monthstransfer' => $mtranfer, 'interestrate' => $rate, 'annualfee' => $annualfee, 'cardtypeid' => $cardid, 'cardtypename' => $ctname, 'cardtypelogo' => $ctlogo, 'interestfreedays' => $freeday, 'latepaymentfee' => $paymentfee, 'minimumrepayment' => $minpayment, 'idcardlevel' => $clid, 'cardlevelname' => $clname, 'phiruttien' => $phiruttien, 'areaofcards' => $areacard, 'linkgotosite' => $linkgosite, 'datecreate' => time(), 'cardlimit' => $hanmuc);
	$condition = array('carddetailid' => $id);
	return $con -> update($tbl, $fn, $condition);
}


?>